In this example the two datasets are given to the constructor as one big multidimensional array. This method can be useful when you're using AJAX.
This goes in the documents header:<script src="RGraph.common.core.js"></script> <script src="RGraph.common.dynamic.js"></script> <script src="RGraph.common.tooltips.js"></script> <script src="RGraph.common.effects.js"></script> <script src="RGraph.line.js"></script>Put this where you want the chart to show up:
<canvas id="cvs" width="600" height="250"> [No canvas support] </canvas>This is the code that generates the chart:
<script> window.onload = function () { var dataset1 = [4,5,1,6,3,5,2]; var dataset2 = [7,7,8,6,2,1,1]; var line = new RGraph.Line({ id: 'cvs', data: [dataset1, dataset2], options: { spline: true, linewidth: 3, hmargin: 5, labels: ['Mon','Tue','Wed','Thu','Fri','Sat','Sun'], tooltips: ['Mon','Tue','Wed','Thu','Fri','Sat','Sun'], tickmarks: 'circle', ticksize: 5, textAccessible: true } }).trace2(); }; </script>